import store from '@/store'
import config from '@/config'
let dologin = false;
/**
 * @param {String} operation  
 * @param {Object} data 请求参数
 * @param {Object} ext 附加参数
 * @param {Number} ext.cache 数据缓存时间，秒
 */
export const request = (operation, data={}, ext={})=>{
	return new Promise((resolve, reject) => {
		uni.request({
			url: config.url + operation,
			header: {
				'token': store.state.token,
				'xversion': 'v1.5'
			},
			data: data,
			method: ext.method || 'GET',
			success: (res) => {
				if(res.data) {
					
				}
				resolve(res.data)
			},
			fail: (res) => {
				reject(res);
			}
		})
	})
}
